<?php
package("Core");

/**
 * Factory to generate new junction adapaters
 *
 */
class Core_Factory {
	
	private function __construct() {
		
	}
	
	/**
	 * Construct a new adapter for the passed schema
	 *
	 * @param String $schema a file containing a junction schema
	 * @return Core_Adapter
	 */
	public function construct($schema) {
		$builder = new Core_Builder();
		return new Core_Adapter($builder->build($schema));
	}
	
	/**
	 * Retrieve a single instance of this class
	 *
	 * @return Core_Factory
	 */
	public static function getSingleton() {
		static $singleton;
		if (!isset($singleton)) {
			$singleton = new Core_Factory(); 
		}
		return $singleton;
	}
}
?>